<template>
  <div>
    <p :style="{ color: theme.color }">C 节点</p>
    <button @click="handleClick">改变 color 为 green</button>
    <hr />
  </div>
</template>

<script>
export default {
  inject: {
    theme: {
      default: () => ({}),
    },
  },
  methods: {
    handleClick() {
      if (this.theme.color) {
        this.theme.changeColor("green");
      }
    },
  },
};
</script>
